#include "Tester.h"

#ifdef __LOGTESTER__ON

#include <Support\Log.h>

TEST(Log, InitAndShutdown)
{
	gLog("This message should not be logged");

	gLogger.initialize(); // Initialization Message logged
	gLogger.initialize(); // No Message logged

	gLogger.shutdown(); // Shutdown Message Message logged
	gLogger.shutdown(); // no Message Message logged

	gLogger.initialize(); // Initialization Message logged
	gLog("This message will be logged");
	gLogger.shutdown(); // Shutdown Message Message logged
}

TEST(Log, TimeStampManagement)
{
	gLogger.initialize();

	gLog("This message has timestamp");
	gLog("This message has no timestamp", false);

	gLogger.shutdown();
}

TEST(Log, LogRedirectionToAFile)
{
	std::ofstream	logBuffer;

	static const char* logFileName = "ManagementFiles\\logFile.txt";

	gLogger.initialize(); // No File Redirection,no Output Stream
	gLog("Testing...");
	gLogger.shutdown();

	gLogger.initialize(logFileName); // File Redirection,no Output Stream
	gLog("Testing...");
	gLogger.shutdown();

	gLogger.initialize(NULL, &logBuffer); // No File Redirection, Output Stream
	gLog("Testing...");
	gLogger.shutdown();

	gLogger.initialize(logFileName, &logBuffer); // File Redirection, Output Stream
	gLog("Testing...");
	gLogger.shutdown();
}
#endif